package ZooManagement;

/**
 * Logistics
 * @author ashongtical
 */
public class Logistics {

    public Item vehicle;
    public Item fuel;
    public String[] caretakers;

    /**
     * Constructor for the Logistics class.
     * Initializes the logistics details including vehicle, fuel, and caretakers.
     *
     * @param vehicle    The vehicle used for transportation
     * @param fuel       The fuel used for the vehicle
     * @param caretakers Array of caretakers responsible for the animal during transportation
     */
    public Logistics(Item vehicle, Item fuel, String[] caretakers) {
        this.vehicle = vehicle;
        this.fuel = fuel;
        this.caretakers = caretakers;
    }

    /**
     * Gets the vehicle used for transportation.
     *
     * @return The vehicle object
     */
    public Item getVehicle() {
        return vehicle;
    }

    /**
     * Sets the vehicle used for transportation.
     *
     * @param vehicle The vehicle object to be set
     */
    public void setVehicle(Item vehicle) {
        this.vehicle = vehicle;
    }

    /**
     * Gets the fuel used for the vehicle.
     *
     * @return The fuel object
     */
    public Item getFuel() {
        return fuel;
    }

    /**
     * Sets the fuel used for the vehicle.
     *
     * @param fuel The fuel object to be set
     */
    public void setFuel(Item fuel) {
        this.fuel = fuel;
    }

    /**
     * Gets the array of caretakers.
     *
     * @return The array of caretakers
     */
    public String[] getCaretakers() {
        return caretakers;
    }

    /**
     * Sets the array of caretakers.
     *
     * @param caretakers The array of caretakers to be set
     */
    public void setCaretakers(String[] caretakers) {
        this.caretakers = caretakers;
    }

    /**
     * Displays the animal transfer invoice.
     * Includes details about the animal, logistics vehicle, fuel, and caretakers.
     *
     * @param fromZooName The name of the zoo where the animal is being transferred from
     * @param toZooName   The name of the zoo where the animal is being transferred to
     * @param animal      The animal being transferred
     */
    public void display(String fromZooName, String toZooName, Animal animal) {
        System.out.println("******* ANIMAL TRANSFER INVOICE *******");
        System.out.println("From: " + fromZooName);
        System.out.println("To: " + toZooName);
        System.out.println("Animal Details:");
        System.out.println("Animal Name: " + animal.getName() + ", Species: " + animal.getSpecies() + ", Age: " + animal.getAge());
        System.out.println("----- Logistics Details -----");
        System.out.println("Vehicle Information:");
        System.out.println("Name: " + vehicle.name + ", Price: $" + vehicle.price + ", Code: " + vehicle.code);
        System.out.println("Fuel Information:");
        System.out.println("Name: " + fuel.name + ", Price: $" + fuel.price + ", Code: " + fuel.code);
        System.out.print("Caretakers: ");
        for (String caretaker : caretakers) {
            System.out.print(caretaker + ", ");
        }
        System.out.println();
        double totalCost = vehicle.price + fuel.price;
        System.out.println("Total Logistics Cost: $" + totalCost);
        System.out.println("-------------------------------------");
        System.out.println("*****************************************");
    }
}